package day0609;

import java.util.Arrays;

public class Test2 {
    public static void main(String[] args) {
        //1.创建数组
        //变量类型  变量名;
        String[]   ts={ "星期1",  "星期2", null };
        //注意：用引用类型定义的数组，默认值是null

        String[]   ts2=new String[3];
        //定义一个变量，指代一个容量为3的数组，里边存储了3个默认值(null)



        //2.获取元素
        System.out.println(ts[2]);

        String s1=ts[ts.length-1];
        System.out.println(s1);


        //3.存入元素
        ts2[0]="a";
        System.out.println(Arrays.toString(ts2));
        //修改元素
        ts[0]="星期3";
        System.out.println(Arrays.toString(ts));


        //用for循环获取数组每个元素
        for(int i=0;i<3; i++){
            String str=ts2[i];
            System.out.println(str);
        }




        int[]  is={6,8,4,9};
        //{6,8,4}
        int[]  is2=Arrays.copyOf(is,3);
        System.out.println(Arrays.toString(is));
        System.out.println(Arrays.toString(is2));







        int[]  i={6,8,4,9};
        int[]  i2=Arrays.copyOf(i,3);
        System.out.println(Arrays.toString(i));
        System.out.println(Arrays.toString(i2));





        //删除9
        int[]  ir={6,8,4,9};
               ir=Arrays.copyOf(ir,3);
        System.out.println(Arrays.toString(ir));


        char[]  it={'a','T','人','9','%'};
        //让it指向  {'a','T'}

    }
}












